package com.lokyiu.mybible.service.impl;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.lokyiu.mybible.db.sqlite.DatabaseHandler;

public abstract class AbstractAndroidService {
	private DatabaseHandler dbHandler;
	public AbstractAndroidService(Context context) {
		dbHandler = new DatabaseHandler(context);
	}
	

	private SQLiteDatabase db;
	public AbstractAndroidService(SQLiteDatabase db) {
		this.db = db;
	}
	protected SQLiteDatabase getWritableDatabase() {
		if (dbHandler == null) {
			return db;
		} else {
			return dbHandler.getWritableDatabase();
		}
	}
	protected SQLiteDatabase getReadableDatabase() {
		if (dbHandler == null) {
			return db;
		} else {
			return dbHandler.getWritableDatabase();
		}
	}

}
